export default Delegator

function Delegator (proto, target) {
  if (!(this instanceof Delegator)) return new Delegator(proto, target)
  this.proto = proto
  this.target = target
  this.methods = []
}

Delegator.prototype.method = function (name) {
  var proto = this.proto
  var target = this.target
  this.methods.push(name)

  proto[name] = function () {
    return target[name].apply(target, arguments)
  }

  return this
}
